function getName(s) {
  return Promise.resolve('name' + s);
}

const template = '234_45-j234+ok_9090';

const matchs = template.match(/(\d+)|(\D+)/g);
const names = matchs.map((item) => (/\d+/.test(item) ? getName(item) : item));
Promise.all(names).then((results) => {
  // 正确结果
  console.log(results.join(''));
});

// 存在BUG
// let result = template;
// Promise.all(matchs.map(getName)).then((names) => {
//   for (let index = 0; index < matchs.length; index++) {
//     const match = matchs[index];
//     const name = names[index];

//     result = result.replace(match, name);
//   }
//   console.log(result);
// });
